package model;

import java.io.Serializable;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import beans.BenCatBean;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class KategorijaPovlastice implements Serializable {

	private static final long serialVersionUID = 5248993112889201197L;

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key sifra;

	private String naziv;

	public KategorijaPovlastice() {
		super();
	}

	public KategorijaPovlastice(String naziv) {
		super();
		this.naziv = naziv;
	}

	public KategorijaPovlastice(Key sifra, String naziv) {
		super();
		this.sifra = sifra;
		this.naziv = naziv;
	}

	public Key getSifra() {
		return sifra;
	}

	public void setSifra(Key sifra) {
		this.sifra = sifra;
	}

	public String getNaziv() {
		return naziv;
	}

	public void setNaziv(String naziv) {
		this.naziv = naziv;
	}

	public BenCatBean toBenCatBean(){
		return new BenCatBean(Integer.valueOf((int)sifra.getId()),naziv);
	}
	
	@Override
	public String toString() {
		return "Kategorija povlastice; sifra: " + sifra + ", naziv: " + naziv;
	}

}